<template>
   <div class="newsinfo-container">
      <h3 class="title">{{newsInfo.title}}</h3>
      <p class="subtitle">
          <span>发表时间：{{newsInfo.add_time | dataFormat}}</span>
          <span>点击:{{newsInfo.click}}</span>
      </p>
      <hr>
      <div class="content" v-html="newsInfo.content"></div>
            <coment-box :id="$route.params.id"></coment-box> 
   </div>
</template>
<script>
import coments from "../subcomponent/coment.vue"
export default {
  data(){
  return {
     newsInfo:{}
  }
  },
  created(){
  this.getNewsInfo()
  },
  methods:{
  getNewsInfo(){
      var id= this.$route.params.id;
      this.$http.get("api/getnew/" + id).then(result=>{
          if(result.body.status===0){
           this.newsInfo=result.body.message[0]
          }
      })
  }
  },
  components:{
  "coment-box":coments
  }
}
</script>
<style>
 .newsinfo-container {
  padding: 0 3px;
  margin: 15px 0;
}
 .newsinfo-container .title{
     font-size: 14px;
     text-align: center;
 }
 .subtitle{
     display: flex;
     justify-content: space-between;
     color: red;
     font-size: 12px;
 }
 .content img{
     width: 100%;
 }
</style>


